package com.zoweunion.mechanic.service.impl;

import com.google.common.collect.Lists;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.util.CellUtil;
import org.springframework.stereotype.Service;

import java.io.File;
import java.lang.reflect.InvocationTargetException;
import java.util.*;

import org.springframework.stereotype.Service;

import java.util.Map;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import org.springframework.beans.factory.annotation.Autowired;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.apache.commons.beanutils.BeanUtils;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import com.zoweunion.mechanic.dao.TSSsMessageRecordMapper;
import com.zoweunion.mechanic.entity.TSSsMessageRecordEntity;
import com.zoweunion.mechanic.service.ITSSsMessageRecordService;
import com.zoweunion.mechanic.entity.dto.TSSsMessageRecordDTO;
import com.zoweunion.mechanic.entity.vo.TSSsMessageRecordVO;

import java.util.List;

import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class TSSsMessageRecordServiceImpl extends ServiceImpl<TSSsMessageRecordMapper, TSSsMessageRecordEntity> implements ITSSsMessageRecordService {

    @Autowired
    private TSSsMessageRecordMapper tSSsMessageRecordMapper;


    @Override
    public PageInfo listPage(Map<String, Object> map) {

        Integer pageSize = Integer.valueOf(map.get("pageSize").toString());
        Integer currentPage = Integer.valueOf(map.get("currentPage").toString());
        PageHelper.startPage(currentPage, pageSize);

        List<TSSsMessageRecordVO> mapList = tSSsMessageRecordMapper.findByCondition(map);
        PageInfo<TSSsMessageRecordVO> mapPageInfo = new PageInfo<>(mapList);
        return mapPageInfo;
    }


//    @Override
//    public List<TSSsMessageRecordExcel> listExport(Map<String, Object> params) throws InvocationTargetException, IllegalAccessException {
//
//
//        PageHelper.startPage(1, 10);
//
//        List<TSSsMessageRecordVO> tSSsMessageRecordVOS = tSSsMessageRecordMapper.findByCondition(params);
//
//        // 转化格式
//        List<TSSsMessageRecordExcel> excels = new ArrayList<>();
//        TSSsMessageRecordExcel excel = new TSSsMessageRecordExcel();
//        for (TSSsMessageRecordVO item : tSSsMessageRecordVOS) {
//            BeanUtils.copyProperties(excel, item);
//            excels.add(excel);
//        }
//
//        return excels;
//    }


}

